﻿using FlightTicketModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.Threading.Tasks;
using WebServices;
using WebServices.Models;
using WebServices.Responses;

namespace FlightTicketContract
{
    /// <summary>
    /// 航司及账户管理
    /// </summary>
    public interface IAirline
    {
        /// <summary>
        /// 添加航司
        /// </summary>
        /// <param name="AirlineName">航司</param>
        /// <param name="Url">网址</param>
        /// <param name="domain">域名</param>
        /// <returns></returns>
        [OperationContract]
        [DataContractFormat]
        [WebInvoke(UriTemplate = "Airline/AddAirline", Method = "POST",
                ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        [ServiceKnownType(typeof(ResponseBoolBase))]
        ResponseBoolBase AddAirline(string AirlineName, string Url, string domain);

        /// <summary>
        /// 更新航司
        /// </summary>
        /// <param name="id"></param>
        /// <param name="AirlineName">航司</param>
        /// <param name="Url">网址</param>
        /// <param name="domain">域名</param>
        /// <returns></returns>
        [OperationContract]
        [DataContractFormat]
        [WebInvoke(UriTemplate = "Airline/SaveAirline", Method = "POST",
                ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        [ServiceKnownType(typeof(ResponseBoolBase))]
        ResponseBoolBase SaveAirline(long id, string AirlineName, string Url, string domain);

        /// <summary>
        /// 更新账号密码
        /// </summary>
        /// <param name="id"></param>
        /// <param name="uname"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        [OperationContract]
        [DataContractFormat]
        [WebInvoke(UriTemplate = "Airline/SaveAirlineAccount", Method = "POST",
                ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        [ServiceKnownType(typeof(ResponseBoolBase))]
        ResponseBoolBase SaveAirlineAccount(long id, string uname, string pwd);

        /// <summary>
        /// 给航司添加账户密码
        /// </summary>
        /// <param name="id"></param>
        /// <param name="uname"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        [OperationContract]
        [DataContractFormat]
        [WebInvoke(UriTemplate = "Airline/AddAirlineAccount", Method = "POST",
                ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        [ServiceKnownType(typeof(ResponseBoolBase))]
        ResponseBoolBase AddAirlineAccount(long id, string uname, string pwd);

        /// <summary>
        /// 获取所有航司及账户
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        [DataContractFormat]
        [WebInvoke(UriTemplate = "Airline/GetAirline", Method = "GET",
                ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        [ServiceKnownType(typeof(ResponseBoolBase))]
        ResponseDataBase<Airline> GetAirline();
    }
}
